using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class DM_DocumentMap : EntityTypeConfiguration<DM_Document>
    {
        public DM_DocumentMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Title)
                .HasMaxLength(100);

            this.Property(t => t.RecordNumber)
                .HasMaxLength(20);

            this.Property(t => t.RecordType)
                .HasMaxLength(50);

            this.Property(t => t.Number)
                .HasMaxLength(20);

            this.Property(t => t.Keywords)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("DM_Document");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Title).HasColumnName("Title");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Createdby).HasColumnName("Createdby");
            this.Property(t => t.RecordNumber).HasColumnName("RecordNumber");
            this.Property(t => t.RecordType).HasColumnName("RecordType");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.Keywords).HasColumnName("Keywords");
            this.Property(t => t.Notes).HasColumnName("Notes");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Closed).HasColumnName("Closed");
        }
    }
}
